<?php

declare(strict_types=1);

namespace app\model\api\admin\system;

use think\Model;
use think\facade\Cache;
use app\library\api\admin\Auth;
use app\common\constant\CacheKey;
use think\model\concern\SoftDelete;

class AdminAuthRule extends Model
{
    use SoftDelete;

    public const STATUS_DISABLE = 0;
    public const STATUS_NOMAL = 1;

    public static function onAfterWrite($model)
    {
        $auth = Auth::instance();
        $auth->clearCache(null, [], ['CACHE_AUTH_MENU_TAG', 'CACHE_AUTH_LIST_TAG']);
    }
}
